home *** CD-ROM | disk | FTP | other *** search
- /**
- GRAB Graph Layout and Browser System
-
- Copyright (c) 1986, 1988 Regents of the University of California
- Copyright (c) 1989, Tera Computer Company
- **/
-
- /* getinp.c - routines to get text input from user. using a dialogbox */
-
- #include <stdio.h>
- #include <sgtty.h>
- #include <ctype.h>
- #include <string.h>
-
- #include "digraph.h"
- #include "globals.h"
- #include "interf.h"
- #include "cursor.h"
-
- int (*endproc)();
-
- /**
- Call TakeTextInput with the name of a procedure to call when
- the text is taken.
-
- This endProc business seems a little silly, but that's the way
- it was originally and I didn't bother changing things
-
- Invariably, endProc will want to call OutofText to get the result
- **/
-
- TakeTextInput(endProc)
- int (*endProc)();
- {
- endproc = endProc;
- ISetCursor(textC);
- IntoText();
- IUnsetCursor();
- (*endProc)();
- }
-
- #define TEXT_BUF_MAX 40 /* length of input line */
- char text_buf[TEXT_BUF_MAX+1];
-
- OutofText(str)
- char *str;
- /**
- str should be at least TEXT_BUF_MAX + 1 characters long
- **/
- {
- strcpy(str, text_buf);
- }
-
- IntoText()
- {
- char *s;
-
- if ((s = IGetText()) == NULL)
- {
- strcpy (text_buf, NULL_STRING);
- }
- else
- {
- strncpy (text_buf, s, TEXT_BUF_MAX);
- }
- }
-